
/*
 * GET home page.
 */

exports.index = function(req, res){
  res.render('index', { title: 'Express' });
};

exports.logout = function(req,res){
    res.redirect('/');
}

exports.dologin =function(req,res){

    var user={
        username:'admin',
        password:'pwd'
    }
    if(req.body.username==user.username && req.body.password==user.password)
    {
        return res.redirect('/home')
    }
    else{
        return res.redirect('/login');
    }
}

exports.login = function(req,res){
    res.render('login',{title:'登录'});
}

exports.home = function(req,res){
    var user={
        username:'admin',
        password:'pwd'
    };
    res.render('home',{title:'home',user:user});
}